/*
 * \brief  Client-side framebuffer interface
 * \author Norman Feske
 * \date   2006-07-10
 */

/*
 * Copyright (C) 2006-2009 Norman Feske
 * Genode Labs, Feske & Helmuth Systementwicklung GbR
 *
 * This file is part of the Genode OS framework, which is distributed
 * under the terms of the GNU General Public License version 2.
 */

#ifndef _INCLUDE__FRAMEBUFFER_SESSION__CLIENT_H_
#define _INCLUDE__FRAMEBUFFER_SESSION__CLIENT_H_

#include <framebuffer_session/capability.h>
#include <base/ipc.h>

namespace Framebuffer {

	class Session_client : public Session
	{
		private:

			Genode::Msgbuf<256> _snd_msg, _rcv_msg;
			Genode::Ipc_client  _ipc_client;

		public:

			/**
			 * Constructor
			 */
			explicit Session_client(Session_capability session)
			: _ipc_client(session, &_snd_msg, &_rcv_msg) { }


			/***********************************
			 ** Framebuffer session interface **
			 ***********************************/

			Genode::Dataspace_capability dataspace()
			{
				Genode::Dataspace_capability ds;
				_ipc_client << DATASPACE << Genode::IPC_CALL >> ds;
				return ds;
			}

			void info(int *out_w, int *out_h, Mode *out_mode)
			{
				_ipc_client << INFO << Genode::IPC_CALL >> *out_w >> *out_h >> *out_mode;
			}

			void refresh(int x, int y, int w, int h)
			{
				_ipc_client << REFRESH << x << y << w << h << Genode::IPC_CALL;
			}
	};
}

#endif /* _INCLUDE__FRAMEBUFFER_SESSION__CLIENT_H_ */
